package com.yanggu.flink.datastream_api.transform

import org.apache.flink.streaming.api.scala._

/**
 * 对于每一个流内元素进行判断，若为 true 则元素正常输出，若为 false 则元素被过滤掉。一般用于数据的过滤
 */
object FilterFunctionDemo {

  def main(args: Array[String]): Unit = {
    val env = StreamExecutionEnvironment.getExecutionEnvironment

    env.fromElements(1, 2, 3)
      //使用匿名函数
      .filter(data => data.==(1))
      .print("filter >").setParallelism(1)

    env.execute()
  }

}
